namespace Sirius.Mapper.Test.Enities
{
    using System;

    public class CustomerInfo : IEquatable<CustomerInfo>
    {
        public int? Id { get; set; }
        public int? ParentId { get; set; }
        public string Name { get; set; }


        public bool Equals(CustomerInfo other)
        {
            if(other == null)
                return false;

            if (Id != other.Id)
                return false;

            if (ParentId != other.ParentId)
                return false;

            return Name == other.Name;
        }

        public override int GetHashCode()
        {
            var hash = 13;

            hash = hash * 7 + Id.GetValueOrDefault().GetHashCode();
            hash = hash * 7 + ParentId.GetValueOrDefault().GetHashCode();
            hash = hash * 7 + Name.GetHashCode();

            return hash;
        }

        public override bool Equals(object obj)
        {
            if(obj is CustomerInfo)
            {
                return Equals(obj as CustomerInfo);
            }
            return false;
        }
    }
}